package com.hellpro.lolbox.video.presenter;

import com.hellpro.lolbox.video.model.ClassifyInfoBiz;
import com.hellpro.lolbox.video.model.LoadClassifySecondInfo;
import com.hellpro.lolbox.video.view.fragment.IClassifySecondActivity;

/**
 * 类描述:
 * 创建人:阿犇
 * 创建时间:2016/10/25
 * 备注:
 */

public class ClassifyPresenter {

    private IClassifySecondActivity mIClassifySecondActivity;
    private final ClassifyInfoBiz classifyInfoBiz;

    public ClassifyPresenter(IClassifySecondActivity iClassifySecondActivity){
        classifyInfoBiz = new ClassifyInfoBiz();
        this.mIClassifySecondActivity = iClassifySecondActivity;
    }

    /**
     *
     * 类描述:
     * 创建人:阿犇
     * 创建时间:2016/10/25
     * 备注:下载数据
     */

    public void loadClassifyInfo(int flag){

        if (flag == 1){
            new LoadClassifySecondInfo(mIClassifySecondActivity.getVideoUrl(),mIClassifySecondActivity.getVideoContext(),mIClassifySecondActivity.getClassifyHandler()).startLoadVideoSecondInfo();
        }else {
            String replace = mIClassifySecondActivity.getVideoUrl().replace("p="+(flag-1), ("p=" + flag));
            new LoadClassifySecondInfo(replace,mIClassifySecondActivity.getVideoContext(),mIClassifySecondActivity.getClassifyHandler()).startLoadVideoSecondInfo();
        }
    }

    /**
     *
     * 类描述:
     * 创建人:阿犇
     * 创建时间:2016/10/25
     * 备注:设置适配器
     *
     */
    public void setClassifyLvAdapter(){

        classifyInfoBiz.setVideoRefreshLvAdapter(mIClassifySecondActivity.getData(),mIClassifySecondActivity.getVideoLv(),mIClassifySecondActivity.getVideoContext());
    }
}
